var status = 0;
var choice;
var display;
var slot = 1;

function start() {
    status = -1;
    action(1, 0, 0)
}

function action(f, d, c) {
    if (f == -1) {
        cm.dispose()
    } else {
        if (f == 0) {
            cm.dispose();
            return
        }
        if (f == 1) {
            status++
        }
        if (status == 0) {
            var e = "#d你好，你需要进行装备品质提升吗?#k \r\n#g===================#k#d品质说明#k#g===================#k\r\n#b初级效果:				满级效果:#b     \r\n#r☆☆劣质☆☆			★★劣质★★#b\r\n#r☆☆普通☆☆			★★普通★★#b\r\n#r☆☆优秀☆☆			★★优秀★★#b\r\n#r☆☆精良☆☆			★★精良★★#b\r\n#r☆☆极品☆☆			★★极品★★#b\r\n#r☆☆史诗☆☆			★★史诗★★#b\r\n#r☆☆传说☆☆			★★传说★★#b\r\n#r☆☆神器☆☆			★★神器★★#b\r\n#r☆☆魔王☆☆			★★魔王★★#b\r\n#r☆☆战神☆☆			★★战神★★#b\r\n#r☆☆至尊☆☆			★★至尊★★#b\r\n#r☆☆魔神☆☆			★★魔神★★#b\r\n#r☆☆耀世☆☆			★★耀世★★#b\r\n#r☆☆不朽☆☆			★★不朽★★#b\r\n#r☆☆永恒☆☆			★★永恒★★#b\r\n#r☆☆太上☆☆			★★太上★★#b\r\n#r☆☆混沌☆☆			★★混沌★★#b\r\n#r☆☆无极☆☆			★★无极★★#b\r\n#g===================#k#d强品要求#k#g===================#k\r\n#r        不同类型的装备 强品后效果不同#b\r\n#g==============================================#k\r\n";
            e += "#b#L1#我要提升(装备)品质#l\r\n\r\n\r\n";
            e += "#g==============================================#k\r\n";
            cm.askMenu(e)
        } else {
            if (status == 1) {
                var a = cm.getInventory(1).getItem(1);
                if (a == null) {
                    cm.sendOk("\r\n抱歉你装备栏第一格没有道具");
                    cm.dispose();
                    return
                }
                if (cm.isCash(a.getItemId())) {
                    cm.sendOk("\r\n抱歉现金道具不能进行升品");
                    cm.dispose();
                    return
                }
                switch (c) {
                    case 1:
                        var a = cm.getInventory(1).getItem(1).getItemId();
                        var d = Math.floor(a / 10000);
                        var b = Math.floor(d / 10);
                        if (b == 12 || b == 13 || b == 14 || b == 15) {
                            cm.dispose();
                            cm.openNpc(1530040, 1);
                            return
                        }
                        if (d == 100 || d == 104 || d == 105 || d == 106 || d == 107 || d == 108 || d == 110 || d == 115) {
                            cm.dispose();
                            cm.openNpc(1530040, 2);
                            return
                        }
                        if (d == 111 || d == 112 || d == 113 || d == 103 || d == 101 || d == 102 || d == 119 || d == 114 || d == 116) {
                            cm.dispose();
                            cm.openNpc(1530040, 3);
                            return
                        }
                        cm.askMenuS(e)
                }
            }
        }
    }
}

function start() {
    status = -1;
    action(1, 0, 0)
};